package com.suptrack.web.servlet;

import java.io.IOException;
import java.util.List;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.suptrack.entity.Car;
import com.suptrack.entity.User;
import com.suptrack.entity.Zone;
import com.suptrack.service.CarService;
import com.suptrack.service.UserService;
import com.suptrack.service.ZoneService;

/**
 * Servlet implementation class ManageZoneServlet
 */
@WebServlet("/RegisteredContent/ManageZone")
public class ManageZoneServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	@EJB
	ZoneService zoneservice;
	@EJB
	CarService carservice;
	@EJB
	UserService userservice;
	
  
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession Session= request.getSession();
		User usersession =(User) Session.getAttribute("User");
		if(usersession != null){

			
			User user = userservice.getUserInfo(usersession.getId());
			
			Session.setAttribute("User", usersession);
		
			request.setAttribute("listCar", user.getCar());	
			
		}
		
		request.getRequestDispatcher("/RegisteredContent/ManageZone.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

	}

}
